package cn.ldf.keepaccounts.entity.vo;

import cn.hutool.core.codec.Base64Encoder;
import lombok.Builder;
import lombok.Data;

/**
 * @author ldf
 * @code May there be no bugs in the world!
 */
@Data
@Builder
public class MembersAvatarVO {

    /**
     * 房间id
     */
    private String roomId;
    /**
     * 用户openId
     */
    private String openId;
    /**
     * 用户昵称
     */
    private String nickname;
    /**
     * 头像
     */
    private byte[] avatar;
    /**
     * 头像base64
     */
    private String avatarBase64;
    /**
     * 头像类型
     */
    private String contentType;
    /**
     * 是否已结算
     */
    private boolean settled;
    /**
     * 积分
     */
    private Double score;

    /**
     * 将头像转为base64返回
     * @return 结果集
     */
    public String getAvatarBase64() {
        if (avatar != null){
            avatarBase64 = Base64Encoder.encode(avatar);
            avatar = null;
        }
        return avatarBase64;
    }

    public void setAvatarBase64(String avatarBase64) {
        this.avatarBase64 = avatarBase64;
    }
}
